<?php
	include_once("../../MasterPages/headerPHPScript.php");
	$CourseService = new CourseService();
	$CourseID = $_GET["CourseID"];
	$CourseDTO = new CourseDTO();
	$CourseDTO->CourseID = $CourseID;
	if($CourseID!=0){ $CourseDTO = $CourseService->GetCourseByCourseID($CourseID);}
	$CourseDTO->EmployeeCode = GetCurrentUserCode();
	
	if(isset($_POST["ddlCourse"])){
		$CourseDTO->SubjectCode = $_POST["ddlCourse"];
	}
	
	$CourseDTO->Section = $_POST["section"];
	$CourseDTO->LimitTimeLate = $_POST["timeLimitLate"];

	if($CourseID!=0){
		$CourseService->UpdateCourse($CourseDTO);
	}else{
		$CourseService->InsertCourse($CourseDTO);
	}
	header("location:../index.php?page=teacher-course-management.php");
?>
